package com.review.singleton;

import com.chixing.day06_static.static_demo.Bank;
import com.chixing.day06_static.static_demo.Bank2;

public class BankTest {
    public static void main(String[] args) {
        //Bank 只能实例化一次

        //Bank bank1 = new Bank(); 实例多次
        //指向同一个堆内存
        Bank bank1 = Bank.getBankInstance();
        Bank bank2 = Bank.getBankInstance();
        Bank bank3 = Bank.getBankInstance();


        System.out.println(bank1 == bank2);//是否指向同一块堆内存
        System.out.println(bank2 == bank3);




        Bank2 bank11 = Bank2.getBankInstance();
        Bank2 bank22 = Bank2.getBankInstance();
        Bank2 bank33 = Bank2.getBankInstance();

        System.out.println(bank11 == bank22);//是否指向同一块堆内存
        System.out.println(bank22 == bank33);
    }
}
